import request from '@/utils/request'

/**
 * 保存团队
 * @param data
 * @returns {AxiosPromise}
 */
export function save(data) {
  return request({
    url: '/api/uc/team/save',
    method: 'post',
    data
  })
}


/**
 * 更新团队
 * @param data
 * @returns {AxiosPromise}
 */
export function update(data) {
  return request({
    url: '/api/uc/team/update',
    method: 'post',
    data
  })
}


/**
 * 查询加入的团队
 * @param data
 * @returns {AxiosPromise}
 */
export function listJoined(data) {
  return request({
    url: '/api/uc/team/list_joined',
    method: 'post',
    data
  })
}



/**
 * 邀请用户加入团队
 * @param data
 * @returns {AxiosPromise}
 */
export function inviteJoin(data) {
  return request({
    url: '/api/uc/team/invite_join',
    method: 'post',
    data
  })
}


/**
 * 获取团队下所有用户信息
 * @param data
 * @returns {AxiosPromise}
 */
export function listTeamUser(data) {
  return request({
    url: '/api/uc/team/list_team_user',
    method: 'post',
    data
  })
}

/**
 * 修改团队内用户的身份
 * @param data
 * @returns {AxiosPromise}
 */
export function updateTeamUserRole(data) {
  return request({
    url: '/api/uc/team/update_team_user_role',
    method: 'post',
    data
  })
}


/**
 * 删除团队内成员
 * @param data
 * @returns {AxiosPromise}
 */
export function deletedTeamUser(data) {
  return request({
    url: '/api/uc/team/deleted_team_user',
    method: 'post',
    data
  })
}

// /api/uc/team/is_team_admin 判断当前用户是否是团队管理员
export function isTeamAdmin(data) {
  return request({
    url: '/api/uc/team/is_team_admin',
    method: 'post',
    data
  })
}


// /api/uc/team/delete删除团队

export function deleteTeam(data) {
  return request({
    url: '/api/uc/team/delete',
    method: 'post',
    data
  })
}